/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author TANGQUOCTUAN
 */
@Entity
@Table(name = "CategoryFoods", catalog = "TUNGA", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "CategoryFoods.findAll", query = "SELECT c FROM CategoryFoods c"),
    @NamedQuery(name = "CategoryFoods.findByCaFoodID", query = "SELECT c FROM CategoryFoods c WHERE c.caFoodID = :caFoodID"),
    @NamedQuery(name = "CategoryFoods.findByCaFoodName", query = "SELECT c FROM CategoryFoods c WHERE c.caFoodName = :caFoodName")})
public class CategoryFoods implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Basic(optional = false)
    @Column(name = "CaFoodID", nullable = false)
    private Integer caFoodID;
    @Basic(optional = false)
    @Column(name = "CaFoodName", nullable = false, length = 50)
    private String caFoodName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoryFoods")
    private List<Foods> foodsList;

    public CategoryFoods() {
    }

    public CategoryFoods(Integer caFoodID) {
        this.caFoodID = caFoodID;
    }

    public CategoryFoods(Integer caFoodID, String caFoodName) {
        this.caFoodID = caFoodID;
        this.caFoodName = caFoodName;
    }

    public Integer getCaFoodID() {
        return caFoodID;
    }

    public void setCaFoodID(Integer caFoodID) {
        this.caFoodID = caFoodID;
    }

    public String getCaFoodName() {
        return caFoodName;
    }

    public void setCaFoodName(String caFoodName) {
        this.caFoodName = caFoodName;
    }

    public List<Foods> getFoodsList() {
        return foodsList;
    }

    public void setFoodsList(List<Foods> foodsList) {
        this.foodsList = foodsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (caFoodID != null ? caFoodID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CategoryFoods)) {
            return false;
        }
        CategoryFoods other = (CategoryFoods) object;
        if ((this.caFoodID == null && other.caFoodID != null) || (this.caFoodID != null && !this.caFoodID.equals(other.caFoodID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.CategoryFoods[caFoodID=" + caFoodID + "]";
    }

}
